home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
byt1186b.arc
/
RUNGKUT.LBR
/
REACT.FOR
< prev
next >
Wrap
Text File
|
1986-04-11
|
2KB
|
79 lines
$NOFLOATCALLS
$NODEBUG
$STORAGE:2
c************************************************************************
implicit double precision (a-h,p-z)
dimension y(2),work(34),icom(4)
external freact
common /reacts/ifeval,Da,delta,beta,Hw,Tw
open(2,file= ' ',status= 'new')
ifeval=0
icom(1)=0
icom(2)=0
icom(3)=0
write(*,*) 'Wall Temp.=, Reactant inlet Temp=, htc='
read(*,*) Tw,Tr,U
Tw=Tw/Tr
U=U/1000.0
write(*,*) ' imeth=, tola=, tolr='
read(*,*) imeth,tola,tolr
c**** evaluate constants in the equations
Da=2.d0*5.d0/3.d0
beta=0.03d0*1.d04/1.2d0/1.d0/Tr
delta=1.d3/8.3144d0/Tr
Hw=2.d0*U*2.d0/0.1d0/1.2d0/1.d0/3.d0
c****
hstart=0.01d0
neqn=2
x0=0.d0
xb=0.d0
y(1)=1.d0
y(2)=1.d0
conc=y(1)*0.03
temp=y(2)*Tr
write(2,30)xa,y(1),y(2),hstart
do 20 j=1,10
xa=xb
xb=0.1*dble(j)+x0
call runkut(xa,y,xb,neqn,tola,tolr,hstart,work,
& imeth,ierror,icom,freact)
conc=y(1)*0.03
temp=y(2)*Tr
if(ierror.GT.1)then
write(2,30)xb,y(1),y(2),hstart
write(2,*)' ERROR-Problem too stiff or is discontinous'
close(2)
stop
else
write(2,30)xb,y(1),y(2),hstart
end if
20 continue
if(icom(4).GT.0) write(2,*) ' Severe round-off error possible'
write(2,*) ' Number of function evaluations = ',ifeval
close (2)
stop
30 format(1x,f11.2,1x,d15.6,1x,f15.4,1x,d15.6)
end
c***********************************************************************
c user supplied subroutine containing the system of first
c order ordinary initial value differential equations
subroutine freact(x,y,yprime,neqn)
implicit double precision (a-h,p-z)
dimension y(neqn),yprime(neqn)
common /reacts/ifeval,Da,delta,beta,Hw,Tw
yprime(1)= -Da*y(1)*dexp(delta*(1.d0-1.d0/y(2)))
yprime(2)= beta*Da*y(1)*dexp(delta*(1.d0-1.d0/y(2)))
& -Hw*(y(2)-Tw)
ifeval=ifeval+1
return
end